/* @file acl_ge_stub.cpp
 *
 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All Rights reserved.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */
#include "acl_ge_stub.h"
#include "framework/executor_c/ge_executor.h"
#include "vector.h"

Status AclStub::GetModelDescInfo(uint32_t modelId, ModelInOutInfo *info) {
  (void)modelId;
  (void)info;
  return SUCCESS;
}

Status AclStub::GetModelDescInfoFromMem(const ModelData *modelData,
                                        ModelInOutInfo *info) {
  (void)modelData;
  (void)info;
  return SUCCESS;
}

Status AclStub::LoadDataFromFile(const char *modelPath, ModelData *data) {
  (void)modelPath;
  (void)data;
  return SUCCESS;
}

void AclStub::FreeModelData(ModelData *data) {
  (void)data;
  return;
}

void AclStub::DestoryModelInOutInfo(ModelInOutInfo *info) {
  (void)info;
  return;
}

MockFunctionTest &MockFunctionTest::aclStubInstance() {
  static MockFunctionTest stub;
  return stub;
};

Status GetModelDescInfo(uint32_t modelId, ModelInOutInfo *info) {
  return MockFunctionTest::aclStubInstance().GetModelDescInfo(modelId, info);
}

Status GetModelDescInfoFromMem(const ModelData *modelData,
                               ModelInOutInfo *info) {
  InitVector(&info->input_desc, sizeof(ModelInOutTensorDesc));
  ModelInOutTensorDesc desc1;
  const char *name1 = "1";
  desc1.name = const_cast<char *>(name1);
  desc1.size = 2;
  desc1.format = FORMAT_CHWN;
  desc1.dataType = DT_FLOAT;
  InitVector(&(desc1.dims), sizeof(int64_t));
  int64_t dim1 = 1;
  int64_t dim2 = 2;
  EmplaceBackVector(&(desc1.dims), &dim1);
  EmplaceBackVector(&(desc1.dims), &dim2);

  ModelInOutTensorDesc desc2;
  const char *name2 = "2";
  desc2.name = const_cast<char *>(name2);
  desc2.size = 1;
  desc2.format = FORMAT_CHWN;
  desc2.dataType = DT_FLOAT;
  InitVector(&(desc2.dims), sizeof(int64_t));
  int64_t dim = 1;
  EmplaceBackVector(&(desc2.dims), &dim);

  EmplaceBackVector(&info->input_desc, &desc1);
  EmplaceBackVector(&info->input_desc, &desc2);
  InitVector(&info->output_desc, sizeof(ModelInOutTensorDesc));
  return MockFunctionTest::aclStubInstance().GetModelDescInfoFromMem(modelData,
                                                                     info);
}

Status LoadDataFromFile(const char *modelPath, ModelData *data) {
  return MockFunctionTest::aclStubInstance().LoadDataFromFile(modelPath, data);
}

void FreeModelData(ModelData *data) {
  (void)data;
  return;
}

void DestoryModelInOutInfo(ModelInOutInfo *info) {
  (void)info;
  return;
}